<me:UIWBBST x:Class="WPFExcelReport.TWBVV03"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL" 
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT" 
                    xmlns:VV="clr-namespace:WPFExcelReport;assembly=TVVLIEF" 
                    xmlns:BW="clr-namespace:WPFExcelReport;assembly=TWBBEW" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"  
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                    FontSize="14"
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UIWBBST.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTBoolToVisibilityConverter x:Key="nbv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:KM2YD x:Key="KM2YD"/>
        <ucd:PNumConverter  x:Key="pnum"/>
        <ucd:NOTConverter x:Key="not"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIWBBST.Resources>
    <Grid IsEnabled="{Binding IsBusy,Converter={StaticResource not}}" >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel  Grid.Row="0" Grid.Column="0" Visibility="{Binding IsCanNew,ElementName=TV,Converter={StaticResource bv}}" >
            <WrapPanel>
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock Grid.Column="1" Text="{Binding Source={Localization:Translate Word=分批}}" />
                </Grid>

                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock Grid.Column="1"  Text="{Binding Source={Localization:Translate Word=取消}}"></TextBlock>
                </Grid>
                <Grid Margin="10,0,0,0"  >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Click="WBB62Command" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock Grid.Column="1"   Text="{Binding Source={Localization:Translate Word=留位}}"></TextBlock>
                </Grid>
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="1"   >小卷号</TextBlock>
                    <ex:TXT72 MaxLength="4"  Foreground="Red" PRE="0000"  Text="{Binding WBBPACKNR,Source={StaticResource ResourceKey=vwMaster}}" Width="120"/>
                </Grid>
                <Button Click="PrintLBCommand"  Content="{Binding Source={Localization:Translate Word=标签}}" ></Button>
                <Grid Margin="10,0,0,0" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource nbv}}" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="EditCommand" Height="20" Margin="5,0,0,0" Width="24">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                        </Button.Background>
                    </Button>
                </Grid>
            </WrapPanel>
            <WrapPanel>
                <Grid Margin="10,0,0,0"  >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0" >色级</TextBlock>
                    <SD:TSSD0201 Grid.Column="1" KEY="{Binding TAX,ElementName=TV}" />
                </Grid>
                <Grid Margin="10,0,0,0"  >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0" >格型</TextBlock>
                    <TextBox MaxLength="11" Grid.Column="1" CharacterCasing="Upper" Text="{Binding WBBDPART,Source={StaticResource ResourceKey=vwMaster}}" Width="80"/>
                </Grid>
                <Grid Margin="10,0,0,0" Visibility="{Binding Is2CW,Converter={StaticResource bv},ElementName=TV}" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="MoveSelectedCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock Grid.Column="1" >全部确认</TextBlock>
                </Grid>
            </WrapPanel>
        </StackPanel>
        <DataGrid  Grid.Row="1" Grid.Column="0" 
                   VerticalAlignment="Top"  
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"     
                   ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}" 
                   IsSynchronizedWithCurrentItem="True" 
                   x:Name="dlgMaster"  
                   HorizontalAlignment="Left"
                    RowDetailsVisibilityMode="Visible"  Margin="0,0,0,0"
                    >
            <DataGrid.Columns>
                <DataGridCheckBoxColumn Width="40" Binding="{Binding Path=IsSelected,RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type DataGridRow}}}">
                    <DataGridCheckBoxColumn.HeaderTemplate>
                        <DataTemplate>
                            <CheckBox x:Name="ckbSelectedAll" Checked="ckbSelectedAll_Click" Unchecked="ckbSelectedAll_Unchecked"></CheckBox>
                        </DataTemplate>
                    </DataGridCheckBoxColumn.HeaderTemplate>
                </DataGridCheckBoxColumn>
                <DataGridTextColumn IsReadOnly="True" Binding="{Binding Path=WBBURLIEFSCH, Converter={StaticResource ResourceKey=pnum}}" Header="{Binding Source={Localization:Translate Word=发货单}}"  Width="Auto" />
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=小卷号}}" Binding="{Binding WBBPACKNR}"/>
                <DataGridTextColumn IsReadOnly="True" Binding="{Binding Path=WBBSTKNR, Converter={StaticResource ResourceKey=pnum}}" Header="{Binding Source={Localization:Translate Word=布卷号}}"  Width="80"    />
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=格型}}" Binding="{Binding WBBDPART}" Width="40"/>
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=色级}}" Binding="{Binding WBBTAX}"  Width="40"/>
                <DataGridTextColumn Binding="{Binding Path=WBBISTKLG,Converter={StaticResource d1000}}" Header="{Binding Source={Localization:Translate Word=数量(米)}}"  Width="Auto" />
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=数量(码)}}" Binding="{Binding WBBISTKLG,Converter={StaticResource KM2YD}}"/>
                <DataGridTextColumn IsReadOnly="True" Binding="{Binding Path=WBBAUFKRS, Converter={StaticResource ResourceKey=pnum}}" Width="Auto" />
                <DataGridTextColumn IsReadOnly="True" Binding="{Binding Path=WBBAUFLFD, Converter={StaticResource ResourceKey=pnum}}" Header="{Binding Source={Localization:Translate Word=销售单}}"  Width="Auto" />
                <DataGridTextColumn IsReadOnly="True" Binding="{Binding Path=WBBAUFPOS, Converter={StaticResource ResourceKey=pnum}}"   Width="Auto" />
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=原卷号}}" Binding="{Binding WBBDPART2}" Width="40"/>
            </DataGrid.Columns>
        </DataGrid  >
        <ex:TPage  Grid.Row="2" Visibility="{Binding IsPage,Converter={StaticResource bv}}"/>
        <WrapPanel Grid.Row="3" Background="White">
            <TextBlock Text="{Binding Source={Localization:Translate Word=总数量:}}"  Margin="20,0,0,0"></TextBlock>
            <TextBlock Name="MSUM" Foreground="Red" Margin="20,0,0,0"></TextBlock>
            <TextBlock Text="{Binding Source={Localization:Translate Word=米}}"  Margin="20,0,0,0"></TextBlock>
            <TextBlock Name="YSUM" Foreground="Red" Margin="20,0,0,0"></TextBlock>
            <TextBlock Text="{Binding Source={Localization:Translate Word=码}}"  Margin="20,0,0,0"></TextBlock>
            <TextBlock Text="{Binding Source={Localization:Translate Word=总卷数:}}"  Margin="20,0,0,0"></TextBlock>
            <TextBlock Name="CSUM" Foreground="Red" Margin="20,0,0,0"></TextBlock>
            <ex:TPROCESS/>
        </WrapPanel>
    </Grid>

</me:UIWBBST>
